package com.ifacebox.face.track.utils;

import com.ifacebox.face.track.sevice.FaceThreadService;

import java.util.concurrent.ThreadFactory;

/**
 * @author znn
 */
public class ThreadUtils {
    private static final ThreadFactory THREAD_FACTORY = new FaceThreadService.FaceThreadFactory();

    public static void runThread(Runnable run) {
        newThread(run).start();
    }

    public static Thread newThread(Runnable run) {
        return THREAD_FACTORY.newThread(run);
    }

    @Deprecated
    public static void sleep(long millis) {
        try {
            Thread.sleep(millis);
        } catch (InterruptedException e) {
            throw new RuntimeException(String.format("线程中断！(%s)", e.getMessage()));
        }
    }
}
